package com.itheima.dao;

/*
资源管理
 */
import com.itheima.domain.Permission;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface PermissionDao  {
/*
多表，用过中间表查询
 */
    @Select("select * from permission where id in (select permissionId from role_permission where roleId=#{roleId})")
    public List<Permission> findPermissionByRoleId(String roleId);

    /*
    查询
     */
    @Select("select * from permission")
    public List<Permission> findAll();


    /*
    添加
     */
    @Insert("insert into permission(permissionName,url) values(#{permissionName},#{url}) ")
    public void save(Permission permission);

    /*
    根据id查询
     */
    @Select("select * from permission where id =#{id}")
    public Permission findById(String id);
}
